////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2017-2018 Qualcomm Technologies, Inc.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  camxipeica10.h
/// @brief IPEICA class declarations
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef CAMXIPEICA10_H
#define CAMXIPEICA10_H

#include "camxispiqmodule.h"
#include "ica10setting.h"
#include "ipe_data.h"

CAMX_NAMESPACE_BEGIN

static const FLOAT perspArray[81] =
{
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
    1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
};

static const FLOAT gridArrayX[825] =
{
    -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,
    -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,
     28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238,
    -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,
     22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380,
    -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,
     16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523,
    -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,
     10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665,
    -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,
     4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760,
    -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,
    -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,
     28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238,
    -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,
     22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380,
    -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,
     16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523,
    -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,
     10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665,
    -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,
     4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760,
    -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,
    -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,
     28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238,
    -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,
     22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380,
    -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,
     16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523,
    -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,
     10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665,
    -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,
     4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760,
    -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,
    -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,
     28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238,
    -8190, - 6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,
     22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380,
    -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,
     16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523,
    -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,
     10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665,
    -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,
     4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760,
    -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,
    -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,
     28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238,
    -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,
     22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523, -20475, -18428, -16380,
    -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,   10238,  12285,  14333,
     16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665, -26618, -24570, -22523,
    -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,   4095,   6143,   8190,
     10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760, -32760, -30713, -28665,
    -26618, -24570, -22523, -20475, -18428, -16380, -14333, -12285, -10238, -8190,  -6143,  -4095,  -2048,   0,      2048,
     4095,   6143,   8190,   10238,  12285,  14333,  16380,  18428,  20475,  22523,  24570,  26618,  28665,  30713,  32760,
};

static const FLOAT gridArrayY[825] =
{
    -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576,
    -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576, -24576,
    -24576, -24576, -24576, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528,
    -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528, -22528,
    -22528, -22528, -22528, -22528, -22528, -22528, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480,
    -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480,
    -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -20480, -18432, -18432, -18432, -18432, -18432, -18432,
    -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432,
    -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -18432, -16384, -16384, -16384,
    -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384,
    -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384, -16384,
    -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336,
    -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336, -14336,
    -14336, -14336, -14336, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288,
    -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288, -12288,
    -12288, -12288, -12288, -12288, -12288, -12288, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240,
    -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240,
    -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -10240, -8192,  -8192,  -8192,  -8192,  -8192,  -8192,
    -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,
    -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -8192,  -6144,  -6144,  -6144,
    -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,
    -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,  -6144,
    -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,
    -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,  -4096,
    -4096,  -4096,  -4096,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,
    -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,  -2048,
    -2048,  -2048,  -2048,  -2048,  -2048,  -2048,   0,      0,      0,      0,      0,      0,      0,     0,       0,
     0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,     0,       0,
     0,      0,      0,      0,      0,      0,      0,      0,      0,      2048,   2048,   2048,   2048,  2048,   2048,
     2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,  2048,   2048,
     2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   2048,   4096,  4096,   4096,
     4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,  4096,   4096,
     4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,   4096,  4096,   4096,
     6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,  6144,   6144,
     6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,   6144,  6144,   6144,
     6144,   6144,   6144,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,  8192,   8192,
     8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,   8192,  8192,   8192,
     8192,   8192,   8192,   8192,   8192,   8192,   10240,  10240,  10240,  10240,  10240,  10240,  10240, 10240,  10240,
     10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240, 10240,  10240,
     10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  10240,  12288,  12288,  12288,  12288, 12288,  12288,
     12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288, 12288,  12288,
     12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  12288,  14336, 14336,  14336,
     14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336, 14336,  14336,
     14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336,  14336, 14336,  14336,
     16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384, 16384,  16384,
     16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384,  16384, 16384,  16384,
     16384,  16384,  16384,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432, 18432,  18432,
     18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432,  18432, 18432,  18432,
     18432,  18432,  18432,  18432,  18432,  18432,  20480,  20480,  20480,  20480,  20480,  20480,  20480, 20480,  20480,
     20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480, 20480,  20480,
     20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  20480,  22528,  22528,  22528,  22528, 22528,  22528,
     22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528, 22528,  22528,
     22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  22528,  24576, 24576,  24576,
     24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576, 24576,  24576,
     24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576,  24576, 24576
};

static const UINT GridTransformDefinedOnWidth  = 8192 * 8;
static const UINT GridTransformDefinedOnHeight = 6144 * 8;
static const UINT GridExtarpolateCornerSize    = 4;

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Class for IPE ICA10 Module
///
/// This IQ block adds ICA operations
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class IPEICA10 final : public ISPIQModule
{
public:
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// Create
    ///
    /// @brief  Create ICA Object
    ///
    /// @param  pCreateData  Pointer to resource and intialization data for ICA10 Creation
    ///
    /// @return CamxResultSuccess if successful
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    static CamxResult Create(
        IPEModuleCreateData* pCreateData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// Initialize
    ///
    /// @brief  Initialize parameters
    ///
    /// @param  pInputData Pointer to the Inputdata
    ///
    /// @return CamxResultSuccess if successful
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    virtual CamxResult Initialize(
        const ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// Execute
    ///
    /// @brief  Execute process capture request to configure module
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResultSuccess if successful.
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    virtual CamxResult Execute(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// GetModuleData
    ///
    /// @brief  Get IQ module specific data
    ///
    /// @param  pModuleData    Pointer pointing to Module specific data
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    virtual CAMX_INLINE VOID GetModuleData(
        VOID* pModuleData);

protected:
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// ~IPEICA10
    ///
    /// @brief  Destructor
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    virtual ~IPEICA10();

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// IPEICA10
    ///
    /// @brief  Constructor
    ///
    /// @param  pCreateData Initialization data for IPEICA
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    explicit IPEICA10(
        IPEModuleCreateData* pCreateData);

private:
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// AllocateCommonLibraryData
    ///
    /// @brief  Allocate memory required for common library
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult AllocateCommonLibraryData();

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// DeallocateCommonLibraryData
    ///
    /// @brief  Deallocate memory required for common library
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID DeallocateCommonLibraryData();

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// ValidateDependenceParams
    ///
    /// @brief  Validate the input dependency info from client
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResult Indicates if the input is valid or invalid
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult ValidateDependenceParams(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// CheckDependenceChange
    ///
    /// @brief  Check to see if the Dependence Trigger Data Changed
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return BOOL Indicates if the settings have changed compared to last setting
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL CheckDependenceChange(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// CheckPerspectiveDependencyChange
    ///
    /// @brief  Check to see if the Dependence Trigger Data Changed
    ///
    /// @param  pInputData Pointer to the ISP input data
    /// @param  pChromatix Pointer to the chromatix data structure.
    ///
    /// @return BOOL Indicates if the settings have changed compared to last setting
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL CheckPerspectiveDependencyChange(
        ISPInputData* pInputData,
        VOID*         pChromatix);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// CheckGridDependencyChange
    ///
    /// @brief  Check to see if the Dependence Trigger Data Changed
    ///
    /// @param  pInputData Pointer to the ISP input data
    /// @param  pChromatix Pointer to the chromatix data structure.
    ///
    /// @return BOOL Indicates if the settings have changed compared to last setting
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL CheckGridDependencyChange(
        ISPInputData* pInputData,
        VOID*         pChromatix);


    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// UpdateLUTFromChromatix
    ///
    /// @brief  Check to see if the Dependence Trigger Data Changed
    ///
    /// @param  pLUT Pointer to start of command buffer where Look up tables are present
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID UpdateLUTFromChromatix(
        VOID* pLUT);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// RunCalculation
    ///
    /// @brief  Calculate the Register Value
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResult Indicates if configuration calculation was success or failure
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult RunCalculation(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// WriteLUTtoDMI
    ///
    /// @brief  Write Look up table data pointer into DMI header
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResult Indicates if configuration calculation was success or failure
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult WriteLUTtoDMI(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// UpdateIPEInternalData
    ///
    /// @brief  Update Pipeline input data, such as metadata, IQSettings.
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult UpdateIPEInternalData(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// CreateCmdList
    ///
    /// @brief  Create the Command List
    ///
    /// @param  pInputData Pointer to the ISP input data
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult CreateCmdList(
        ISPInputData* pInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// UpdatePerspectiveParamsToContext
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pWrap                    Pointer to ICA input context
    /// @param  pICAPerspectiveParams    Pointer to ICA configuration data
    ///
    /// @return CamxResult               success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult UpdatePerspectiveParamsToContext(
        VOID* pWrap,
        VOID* pICAPerspectiveParams);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// UpdateGridParamsToContext
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pWrap             Pointer to ICA input context
    /// @param  pICAGridParams    Pointer to ICA configuration data
    ///
    /// @return CamxResult        success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult UpdateGridParamsToContext(
        VOID* pWrap,
        VOID* pICAGridParams);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// IsGridEnabled
    ///
    /// @brief  is Grid Parameters Enabled
    ///
    /// @param  pICAInGridParams    Pointer to grid transform
    ///
    /// @return TRUE if the grid is enabled
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL IsGridEnabled(
        IPEICAGridTransform* pICAInGridParams);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// IsPerspectiveEnabled
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pICAPerspectiveTransform    Pointer to perspective transform
    ///
    /// @return TRUE if perspective is enabled
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    BOOL IsPerspectiveEnabled(
        IPEICAPerspectiveTransform* pICAPerspectiveTransform);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// SetTransformData
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pISPInputData    Pointer to ICA configuration data
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult SetTransformData(
        ISPInputData* pISPInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// AllocateWarpData
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  ppWarpData    Pointer to ICA WarpData
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult AllocateWarpData(
        VOID** ppWarpData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// DeAllocateWarpData
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  ppWarpData    Pointer to ICA WarpData
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID DeAllocateWarpData(
        VOID** ppWarpData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// AllocateWarpAssistData
    ///
    /// @brief  Allocate ICA Warp Assist Data Memory
    ///
    /// @param  ppWarpAssistData    Pointer to ICA Warp Assist Data NcLibWarpBuildAssistGridOut
    ///
    /// @return CamxResult success if the operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult AllocateWarpAssistData(
        VOID** ppWarpAssistData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// DeAllocateWarpAssistData
    ///
    /// @brief  Free ICA Warp Assist Data Memory
    ///
    /// @param  ppWarpAssistData    Pointer to ICA Warp Assist Data NcLibWarpBuildAssistGridOut
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID DeAllocateWarpAssistData(
        VOID** ppWarpAssistData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// AllocateWarpGeomOut
    ///
    /// @brief  Allocate memory for ICA Warp Geometry Output
    ///
    /// @param  ppWarpGeomOut    Pointer to ICA Warp Geometry Output
    ///
    /// @return CamxResult success if the operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CamxResult AllocateWarpGeomOut(
        VOID** ppWarpGeomOut);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// DeAllocateWarpGeomOut
    ///
    /// @brief  Free memory allocated for ICA Warp Geometry Output
    ///
    /// @param  ppWarpGeomOut    Pointer to ICA Warp Geometry Output
    ///
    /// @return None
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    VOID DeAllocateWarpGeomOut(
        VOID** ppWarpGeomOut);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// DumpInputConfiguration
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pInputData       Pointer to ICA Input Data
    /// @param  pICAInputData    Pointer to ICA10 Input Data
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    CamxResult DumpInputConfiguration(
        ISPInputData*   pInputData,
        ICA10InputData* pICAInputData);

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    /// SetModuleEnable
    ///
    /// @brief  Calculate the unpacked register value
    ///
    /// @param  pInputData    Pointer to ICA Input Data
    /// @param  pChromatix    Chromatix data pointer
    ///
    /// @return CamxResult success if the write operation is success
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    CAMX_INLINE CamxResult SetModuleEnable(
        ISPInputData* pInputData,
        ica_1_0_0::chromatix_ica10Type*  pChromatix);

    IPEICA10(const IPEICA10&)            = delete;              ///< Disallow the copy constructor
    IPEICA10& operator=(const IPEICA10&) = delete;              ///< Disallow assignment operator

    CmdBufferManager*   m_pLUTCmdBufferManager;                 ///< Command buffer manager for all LUTs of GRA
    CmdBuffer*          m_pLUTCmdBuffer;                        ///< Command buffer for holding all 4 LUTs
    UINT                m_offsetLUTCmdBuffer[ICAIndexmax];      ///< Offset of all tables within LUT CmdBuffer
    VOID*               m_pLUT[ICAIndexmax];                    ///< Pointer to array of Look up tables supported by ICA
    INT                 m_IPEPath;                              ///< IPE path indicating input or reference.
    VOID*               m_pICAInWarpData[ICAReferenceNumber];   ///< ICA Input data for current and past frame
    VOID*               m_pICARefWarpData;                      ///< ICA Reference data
    VOID*               m_pWarpAssistData[ICAReferenceNumber];  ///< ICA warp assist data for current and past frame
    BOOL                m_enableCommonIQ;                       ///< EnableCommon IQ module
    ICA10InputData      m_dependenceData;                       ///< Dependency data for ICA
    IcaParameters       m_ICAParameter;                         ///< ICA parameter

    UINT32*             m_pICAPerspectiveLUT;                   ///< Tuning LUT data
    UINT32*             m_pICAGrid0LUT;                         ///< Tuning LUT data
    UINT32*             m_pICAGrid1LUT;                         ///< Tuning LUT data
    VOID*               m_pWarpGeometryData;                    ///< Warp Geometry data
    ica_1_0_0::chromatix_ica10Type* m_pChromatix;               ///< Pointer to tuning mode data
    BOOL                m_dumpICAOutput;                        ///< Dump ICA output
};

CAMX_NAMESPACE_END

#endif // CAMXIPEICA10_H
